package com.m.sms.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * Description
 *
 * @Auther [li.wang@jsxfedu.com]
 * @Date 2025/3/20 12:49
 * @Version 1.0
 * @Copyright (c) 2022 京师讯飞
 */
@Data
@Component
@ConfigurationProperties(prefix = "sms")
public class SmsProperties {

    /**
     * 短信服务商
     * ali、tencent、yunpian
     */
    private String type = "yunpian";

    private YunpianProperties yunpian = new YunpianProperties();

    private AliProperties ali = new AliProperties();

    private TencentProperties tencent = new TencentProperties();

    /**
     * 短信发送频率限制，单位：分钟
     */
    private Integer limitMinute = 1;
    /**
     * 短信发送频率限制，单位：小时
     */
    private Integer limitHour = 3;
    /**
     * 短信发送频率限制，单位：小时
     */
    private Integer limit24Hour = 10;

    public Integer getLimitMinute() {
        return Math.max(limitMinute, 1);
    }

    public Integer getLimitHour() {
        return Math.max(limitHour, 3);
    }

    public Integer getLimit24Hour() {
        return Math.max(limit24Hour, 10);
    }
}
